library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.4 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 2.0.1 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(ggplot2)
library(gplots)
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
library(dplyr)
library(readr)
library(gganimate)
library(gifski)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(readxl)
X3_pointers <- read_excel("Downloads/3 pointers.xlsx")
`3PA` <- ggplot(X3_pointers, aes(x=`Season`, y=`3PA`))+
geom_line(aes(group=5, col="red"))+
theme(legend.position = "None")+
ggtitle("3PA per Game by Season")+
xlab("Season")+ylab("Average 3PA per Game")+
transition_reveal(Season)
`3PA`
animate(`3PA`, duration = 9, fps = 3, width=500, height=400, renderer = gifski_renderer())
anim_save("3PAAnimated2.gif")
library(readxl)
X3_pointers <- read_excel("Downloads/3 pointers.xlsx")
`3PM` <- ggplot(X3_pointers, aes(x=`Season`, y=`3PM`))+
geom_line(aes(group=5, color="red"))+
theme(legend.position = "None")+
ggtitle("3PM per Game by Season")+
xlab("Season")+ylab("Average 3PM per Game")+
transition_reveal(Season)
`3PM`
animate(`3PM`, duration = 9, fps = 3, width=500, height=400, renderer = gifski_renderer())
anim_save("3PMAnimated.gif")
library(readxl)
X3_pointers <- read_excel("Downloads/3 pointers.xlsx")
`3P%` <- ggplot(X3_pointers, aes(x=`Season`, y=`3P%`))+
geom_line(aes(group=5, color="red"))+
theme(legend.position = "None")+
ggtitle("3P% by Season")+
xlab("Season")+ylab("Average 3P%")+
transition_reveal(Season)
`3P%`
animate(`3P%`, duration = 9, fps = 3, width=500, height=400, renderer = gifski_renderer())
anim_save("3PM%nimated.gif")
X3toW <- read_excel("Downloads/Data Science Final.xlsx")
pf <- ggplot(X3toW, aes(x=`3P%`, y=`Win %`, col= Team ))+
geom_point(show.legend = FALSE, alpha=0.75)
ggplotly(pf)
Here, we can look at the overall correlation between 3P% and teams Win % over the past 10 NBA seasons. Although the correlation isn’t too strong, it is obvious that there is a relationship between shooting a higher 3P%, and ultimately the number of games you win. This shows that teams that to shoot the best from behind the arc, the more likely they are to win more games.